Skip to content

[mypyc] Add test for incremental builtin_base class construction across groups#21524

Merged
p-sawicki merged 2 commits into
python:masterfrom
VaggelisD:fix-load-type-map-builtin-base
May 22, 2026
Merged

[mypyc] Add test for incremental builtin_base class construction across groups#21524
p-sawicki merged 2 commits into
python:masterfrom
VaggelisD:fix-load-type-map-builtin-base

Conversation

@georgesittas
Copy link
Copy Markdown
Contributor

@georgesittas georgesittas commented May 20, 2026

The fix for this was included in #21369, but no dedicated test was added.

This adds testIncrementalBuiltinBaseClassConstruction to run-multimodule.test: three modules compiled with separate=True, where step 2 changes a helper module's signature to force the caller to be recompiled while the exception module is only loaded from cache.

@p-sawicki
Copy link
Copy Markdown
Collaborator

can i get instructions how to reproduce the original issue? i checked out the parent of the merge commit of #21369 and cherry-picked this test but pytest mypyc/test/test_run.py::TestRunSeparate::run-multimodule.test::testIncrementalBuiltinBaseClassConstruction_separate passed. i've also patched fudge_dir_mtimes in case it forced recompilation without it but it still passed.

@georgesittas
Copy link
Copy Markdown
Contributor Author

Ah, it seems like the test framework only treats files matching other*.py as additional compiled sources (source, comment), anything else is written to disk as plain Python, not added to the build.

I missed this and named the helper files myerrors.py and myutil.py, so MyError would not be in a compiled group. Which is why the bug, which needs cross-group emit, is not triggered.

Sorry for the confusion. Feel free to give it another shot; I also verified that the test fails in the parent commit and should pass in this PR.

Copy link
Copy Markdown
Collaborator

@p-sawicki p-sawicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, now it reproduces. thanks!

@p-sawicki p-sawicki merged commit e61adea into python:master May 22, 2026
18 checks passed
@georgesittas georgesittas deleted the fix-load-type-map-builtin-base branch May 22, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants